CREATE PROCEDURE sp_InsertaPlano_x_Expediente

@Expediente varchar(20) ,
@Item tinyint , 
@Num_Plano varchar(30) , 
@Area smallint ,
@Hoja_Cartografica varchar(100) , 
@Vertical_Inicial smallint ,
@Vertical_Final smallint ,
@Horizontal_Inicial smallint ,
@Horizontal_Final smallint ,
@Observaciones varchar(125) ,
@Cedula_Usuario int , 
@Return int OUTPUT

AS

DECLARE
@Error int 

SET XACT_ABORT ON
BEGIN TRANSACTION

INSERT Planos_x_Expediente VALUES( 
		@Expediente , 
		@Item , 
		@Num_Plano , 
		@Area ,
		@Hoja_Cartografica , 
		@Vertical_Inicial ,
		@Vertical_Final ,
		@Horizontal_Inicial ,
		@Horizontal_Final ,
		@Observaciones ,
		@Cedula_Usuario ) 

SET @Error = @@error
IF @Error = 0
	BEGIN
	COMMIT TRANSACTION
	SET @Return = 0
	END
ELSE
	BEGIN
	ROLLBACK TRANSACTION
	SET @Return = -1
	END

SET XACT_ABORT OFF

SELECT @Return 
RETURN 
